package org.microservice.system.controller;

import org.microservice.common.base.BaseControllerImpl;
import org.microservice.common.entity.SysLog;
import org.microservice.common.util.PageUtils;
import org.microservice.common.util.Query;
import org.microservice.common.util.R;
import org.microservice.system.dao.SysLogDao;
import org.microservice.system.service.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: 齐丹枫
 * Date: 2018/7/24
 * Time: 8:55
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@RestController
@RequestMapping("/log")
public class SysLogController extends BaseControllerImpl<SysLogDao,SysLog> {

    @Autowired
    private SysLogService sysLogService;

    @PostMapping("/getLogListPage")
    public R getListPage(@RequestBody Map<String, Object> params){
        Query query = new Query(params);
        List<SysLog> list = sysLogService.getLogListPage(query);
        int total = sysLogService.getLogListPageTotal(query);
        PageUtils pageUtils = new PageUtils(list, total, query.getLimit(), query.getCurrPage());
        return R.ok().put("data",pageUtils);

    }


}
